import { computed } from 'vue';
import { EChartsOption } from 'echarts';

interface optionsFn {
  (isDark: boolean): EChartsOption;
}

export const useChartOption = (sourceOption: optionsFn) => {
  const local = useLocal();
  const isDark = computed(() => {
    return local.theme == 'dark';
  });
  const chartOption = computed<EChartsOption>(() => {
    return sourceOption(isDark.value);
  });
  return {
    chartOption,
  };
}
